<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>htmlcss 阶段</title>
    <style>
        .wrap {
            height: 100px;
            line-height: 100px;
            background-color: #ccc;
            text-align: center;
            width: 750px;
            margin: 0 auto;
            font-size: 0;
        }
        .wrap  >  span {
            display: inline-block;
            vertical-align: middle;
            width: 60px;
            height: 60px;
            border-radius: 50%;
            border: 1px solid #ccc;
            line-height: 60px;
            font-size: 18px;
            margin: 0 10px;
            background-color: red;
            color: white;
            font-weight: bold;
        }
        .wrap >  span:nth-child(7) {
            background-color: deepskyblue;
        }
    </style>
</head>
<body>


    <!-- <div class="wrap">
        <span>10</span>
        <span>23</span>
        <span>08</span>
        <span>05</span>
        <span>30</span>
        <span>19</span>
        <span>6</span>
    </div> -->


<script>
    // 要求：
    // 定义变量，接收输入弹窗的输入的值（字符串） 
    // 弹窗输入的格式: 10,23,08,05,30,19,6
    // 把字符串 "10,23,08,05,30,19,6" 切割成数组
    // 数组的数据渲染在页面,如图1所示：

    // str = prompt();

    // str = str.split(",");

    // var html =  "";
    // html += "<div class='wrap'>"
    // for(var i = 0 ; i < str.length ; i ++) {
    //     html += "<span>" +str[i] + "</span>";
    // }
    // html += "</div>";

    // document.write(html)

    function foo(){
        var str = window.prompt();
        var arr = str.split(",");
        console.log(arr);
        var html ="";
        html +="<div class='wrap'>";
            for(var i = 0 ; i <arr.length ; i ++) {
                html +="<span>"+arr[i]+"</span>";
            }
        html +="</div>";
        document.write(html);
    }
    foo();

    // var str = prompt("请输入值");
    // var res = str.split(",");
    // console.log(res); 
</script>
</body>
</html>